/* eslint-disable @typescript-eslint/no-explicit-any */
import { ref } from 'vue';
import { defineStore } from 'pinia';

export const useAppStore = defineStore('app', () => {
  // 显示左侧菜单栏
  const sidebar = ref<boolean | undefined>();
  // 显示页面设置面板
  const setting = ref<boolean>(false);

  // 错误日志
  const errorLogs = ref<any[]>([]);
  function addErrorLog(err: any) {
    errorLogs.value.push(err);
  }
  function clearErrorLogs() {
    errorLogs.value = [];
  }

  // 返回state
  return { sidebar, setting, errorLogs, addErrorLog, clearErrorLogs };
});
